af_unix: Add sockaddr length checks before accessing sa_family in bind and connect...
authorMateusz Jurczyk <mjurczyk@google.com>
Thu, 8 Jun 2017 09:13:36 +0000 (11:13 +0200)
committerRaspbian kernel package updater <root@raspbian.org>
Sun, 23 Jul 2017 03:03:19 +0000 (03:03 +0000)
commit94ee2714bc0c30924c826e393f9ce9e62f72b628
treee83a6579081bcd9928d589e557640bda7c9fa265
parent228a684fb4a4ab6b71be8bdf51c573edef172a48
af_unix: Add sockaddr length checks before accessing sa_family in bind and connect handlers

[ Upstream commit defbcf2decc903a28d8398aa477b6881e711e3ea ]

Verify that the caller-provided sockaddr structure is large enough to
contain the sa_family field, before accessing it in bind() and connect()
handlers of the AF_UNIX socket. Since neither syscall enforces a minimum
size of the corresponding memory region, very short sockaddrs (zero or
one byte long) result in operating on uninitialized memory while
referencing .sa_family.

Signed-off-by: Mateusz Jurczyk <mjurczyk@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/unix/af_unix.c